<template>
  <div class="dashboard">
    <el-card class="welcome-card">
      <template #header>
        <div class="card-header">
          <span>欢迎使用平台运营管理后台</span>
        </div>
      </template>
      <div class="welcome-content">
        <h2>平台概览</h2>
        <p>这里是平台运营管理后台的主页面，您可以在这里查看系统的整体运行状态和关键指标。</p>
        
        <el-row :gutter="20" style="margin-top: 30px;">
          <el-col :span="8">
            <el-card class="stat-card">
              <div class="stat-item">
                <el-icon class="stat-icon"><User /></el-icon>
                <div class="stat-info">
                  <div class="stat-value">1,234</div>
                  <div class="stat-label">注册用户</div>
                </div>
              </div>
            </el-card>
          </el-col>
          <el-col :span="8">
            <el-card class="stat-card">
              <div class="stat-item">
                <el-icon class="stat-icon"><OfficeBuilding /></el-icon>
                <div class="stat-info">
                  <div class="stat-value">89</div>
                  <div class="stat-label">活跃租户</div>
                </div>
              </div>
            </el-card>
          </el-col>
          <el-col :span="8">
            <el-card class="stat-card">
              <div class="stat-item">
                <el-icon class="stat-icon"><TrendCharts /></el-icon>
                <div class="stat-info">
                  <div class="stat-value">¥1.2M</div>
                  <div class="stat-label">本月收入</div>
                </div>
              </div>
            </el-card>
          </el-col>
        </el-row>
        
        <div class="quick-actions" style="margin-top: 30px;">
          <h3>快捷操作</h3>
          <el-row :gutter="20">
            <el-col :span="6">
              <el-button type="primary" plain @click="goToTenant">租户管理</el-button>
            </el-col>
            <el-col :span="6">
              <el-button type="success" plain @click="goToFinance">财务管理</el-button>
            </el-col>
            <el-col :span="6">
              <el-button type="warning" plain @click="goToSystem">系统运维</el-button>
            </el-col>
            <el-col :span="6">
              <el-button type="danger" plain @click="goToSecurity">安全管理</el-button>
            </el-col>
          </el-row>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
import { User, OfficeBuilding, TrendCharts } from '@element-plus/icons-vue'

const router = useRouter()

const goToTenant = () => {
  router.push('/tenant/organization')
}

const goToFinance = () => {
  router.push('/finance/income')
}

const goToSystem = () => {
  router.push('/system/monitor')
}

const goToSecurity = () => {
  router.push('/security/permission')
}
</script>

<style scoped>
.dashboard {
  padding: 20px;
}

.welcome-card {
  margin-bottom: 20px;
}

.card-header {
  font-size: 18px;
  font-weight: bold;
}

.welcome-content h2 {
  margin-bottom: 15px;
}

.welcome-content p {
  color: #666;
  line-height: 1.6;
}

.stat-card {
  text-align: center;
}

.stat-item {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
}

.stat-icon {
  font-size: 32px;
  color: #409eff;
  margin-right: 15px;
}

.stat-info {
  text-align: left;
}

.stat-value {
  font-size: 24px;
  font-weight: bold;
  color: #333;
}

.stat-label {
  font-size: 14px;
  color: #666;
  margin-top: 5px;
}

.quick-actions h3 {
  margin-bottom: 20px;
}

.el-button {
  width: 100%;
  margin-bottom: 10px;
}
</style>